package facilius.controller;

import java.util.ArrayList;
import java.util.List;
import org.mentawai.authorization.Group;

/**
 *
 * @author Graciano
 */
public class GroupManager {

    private List<Group> grupos;
    private static GroupManager instance;

    private GroupManager() {
        grupos = new ArrayList<Group>();
        grupos.add(addAdmin());
        grupos.add(addProfessor());
        grupos.add(addAluno());
    }

    public static GroupManager getInstance() {
        if (instance == null) {
            instance = new GroupManager();
        }
        return instance;
    }

    public List<Group> getGroups() {
        return grupos;
    }

    private Group addAdmin() {
        Group group = new Group("GR_ADMIN");
        group.addPermission("instituicao");
        group.addPermission("usuario");
        group.addPermission("curso");
        group.addPermission("disciplina");
        group.addPermission("turma");
        group.addPermission("tipoNota");
        group.addPermission("usuarioCurso");
        group.addPermission("usuarioCursoTurma");
        return group;
    }

    private Group addProfessor() {
        Group group = new Group("GR_PROFESSOR");
        group.addPermission("aula");
        group.addPermission("material");
        group.addPermission("frequencia");
        group.addPermission("nota");
        return group;
    }

    private Group addAluno() {
        Group group = new Group("GR_ALUNO");
        group.addPermission("espaco");

        return group;
    }
}
